package com.net.oil.action.presenter;

import com.net.oil.action.bean.ActionDetailBean;
import com.net.oil.action.contract.ActionDetailContract;
import com.net.oil.action.model.ActionDetailModel;
import com.net.oil.base.BasePresenter;
import com.net.oil.http.custom.ApiException;

/**
 * 作者：lch
 * 时间：2018/5/17 0017:下午 21:08
 * 邮箱：245850413@qq.com
 * 说明：
 */

public class ActionDetailPresenter extends BasePresenter<ActionDetailContract.View> implements ActionDetailContract.Presenter {

    private ActionDetailContract.View view;
    private ActionDetailContract.Model model;

    public ActionDetailPresenter(ActionDetailContract.View view) {
        this.view = view;
        model = new ActionDetailModel(this);
    }

    @Override
    protected void unSubscribe() {
        model.unSubscribe();
    }

    @Override
    public void getActionDetail(int actionId) {
        model.getActionDetail(actionId);
    }

    @Override
    public void getActionDetailSuccess(ActionDetailBean actionDetailBean) {
        view.getActionDetailSuccess(actionDetailBean);
    }

    @Override
    public void getActionDetailFailed() {
        view.getActionDetailFailed();
    }

    @Override
    public void getCoupon(int actionId) {
        model.getCoupon(actionId);
    }

    @Override
    public void getCouponSuccess() {
        view.getCouponSuccess();
    }

    @Override
    public void getCouponFailed(ApiException e) {
        view.getCouponFailed(e);
    }
}
